package pyip.lib.javalearn;

import java.io.PrintWriter;
import java.io.StringWriter;

public class ExceptionStackRedirect {
    public static void main(String[] args) {
        StringWriter out = new StringWriter();
        try {
            throw new Exception("test stack trace redirect");
        } catch (Exception e) {
            e.printStackTrace(new PrintWriter(out));
            System.err.println(out.toString());
        }
    }

}